#include "querywin.h"
#include "ui_querywin.h"

QueryWin::QueryWin(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::QueryWin)
{
    ui->setupUi(this);
    model = new QSqlTableModel();
}

QueryWin::~QueryWin()
{
    delete ui;
}

void QueryWin::on_btn_search_clicked()
{
    if(ui->rbtn_employee->isChecked())
    {
        model->setTable("employee");    //设置员工表格
    }
    if(ui->rbtn_attend->isChecked())
    {
        model->setTable("attendance");  //设置考勤表
    }

    //设置过滤器
//    model->setFilter("name='张三'");
    model->select();

    ui->tableView->setModel(model);

}
